import Vue from 'vue'
import Router from 'vue-router'

Vue.use(Router)

let routers = new Router({
    routes: [
        {//默认地址
            path: '/',
            name: 'login',
            component: resolve => require(['@/views/login/login'], resolve)
        },
        { //忘记密码
            path: '/forgetPassword',
            name: 'forgetPassword',
            component: resolve => require(['@/views/forgetPassword/forgetPassword'], resolve)
        },
        {//跳转地址重定向
            path: "/index",
            name: "index",
            redirect: "/home",
            component: resolve =>
                require(["@/components/index"], resolve),
            children: [
                {
                    path: "/home",
                    name: "首页",
                    component: resolve =>
                        require(["@/views/home/home"], resolve)
                },
                {
                    path: "/financial",
                    name: "数据报表",
                    component: resolve => require(["@/App"], resolve),
                    children: [
                        {
                            path: "/financialSheet",
                            name: "财务报表(总表)",
                            component: resolve =>
                                require([
                                    "@/views/financial/financialSheet"
                                ], resolve)
                        },
                        {
                            path: "/financialSubmeter",
                            name: "财务报表(分表)",
                            component: resolve =>
                                require([
                                    "@/views/financial/financialSubmeter"
                                ], resolve)
                        },
                        {
                            path: "/earningsAccount",
                            name: "收益结算",
                            component: resolve =>
                                require([
                                    "@/views/financial/earningsAccount"
                                ], resolve)
                        },
                    ]
                },
                {
                    path: "/priceAdjust ",
                    name: "价格调整",
                    component: resolve => require(["@/App"], resolve),
                    children: [
                        {
                            path: "/price",
                            name: "洗车价格管理",
                            component: resolve =>
                                require([
                                    "@/views/price/price"
                                ], resolve)
                        },
                        {
                            path: "/topUp",
                            name: "充值价格管理",
                            redirect: "/upnext",
                            component: resolve =>
                                require([
                                    "@/views/price/topUp/topUp"
                                ], resolve),
                            children: [
                                {
                                    path: "/upnext",
                                    name: "次卡充值方案",
                                    component: resolve => require(["@/views/price/topUp/upnext"], resolve),
                                    meta: {
                                        title: "充值价格管理",
                                        GuidePath: true,
                                        JumpPath: "/topUp"
                                    }
                                },
                                {
                                    path: "/upbalance",
                                    name: "余额重置方案",
                                    component: resolve => require(["@/views/price/topUp/upbalance"], resolve),
                                    meta: {
                                        title: "充值价格管理",
                                        GuidePath: true,
                                        JumpPath: "/topUp"
                                    }
                                },
                            ]
                        },
                        {
                            path: "/overtimePrice",
                            name: "超时价格管理",
                            component: resolve =>
                                require([
                                    "@/views/price/overtimePrice"
                                ], resolve)
                        },
                        {
                            path: "/earningsManagement",
                            name: "收益结算管理",
                            component: resolve =>
                                require([
                                    "@/views/price/earningsManagement"
                                ], resolve)
                        },
                    ]
                },
                {
                    path: "/editPrice",
                    name: "修改价格",
                    hidden: true,
                    component: resolve =>
                        require([
                            "@/views/price/editPrice/editPrice"
                        ], resolve),
                    meta: {
                        title: "修改价格",
                        GuidePath: true,
                        JumpPath: "/price"
                    }
                },
                {
                    path: "/oneCarWash",
                    name: "一元洗车",
                    component: resolve => require(["@/App"], resolve),
                    children: [
                        {
                            path: "/oneCarWashSheet",
                            name: "一元洗车(总表)",
                            component: resolve =>
                                require([
                                    "@/views/oneCarWash/oneCarWashSheet"
                                ], resolve)
                        },
                        {
                            path: "/oneCarWashSubmeter",
                            name: "一元洗车(分表)",
                            component: resolve =>
                                require([
                                    "@/views/oneCarWash/oneCarWashSubmeter"
                                ], resolve)
                        },
                    ]
                },
                {
                    path: "/order",
                    name: "订单系统",
                    component: resolve => require(["@/App"], resolve),
                    children: [
                        {
                            path: "/carWash",
                            name: "洗车订单",
                            component: resolve =>
                                require(["@/views/orderSystem/carWash/carWash"], resolve)
                        },
                        {
                            path: "/topupOrder",
                            name: "充值订单",
                            component: resolve =>
                                require(["@/views/orderSystem/topupOrder"], resolve)
                        },
                        {
                            path: "/ovettimeOrder",
                            name: "超时订单",
                            component: resolve =>
                                require(["@/views/orderSystem/ovettimeOrder"], resolve)
                        }
                    ]
                },
                {
                    path: "/userCenter",
                    name: "用户中心",
                    component: resolve =>
                        require([
                            "@/views/userCenter/userCenter"
                        ], resolve)
                },
                {
                    path: "/car",
                    name: "车辆管理",
                    component: resolve => require(["@/App"], resolve),
                    children: [
                        {
                            path: "/carOperation",
                            name: "车辆信息",
                            component: resolve =>
                                require([
                                    "@/views/userCenter/carOperation/carOperation"
                                ], resolve),
                            meta: {
                                title: "车辆信息",
                                GuidePath: true,
                                JumpPath: "/userCenter"
                            }
                        },
                        {
                            path: "/carMember",
                            name: "车辆会员",
                            component: resolve =>
                                require([
                                    "@/views/userCenter/carOperation/carMember"
                                ], resolve),
                            meta: {
                                title: "车辆会员",
                                GuidePath: true,
                                JumpPath: "/carOperation"
                            }
                        }
                    ]
                },
                {
                    path: "/equipment",
                    name: "设备管理",
                    component: resolve =>
                        require([
                            "@/views/equipment/equipment"
                        ], resolve)
                },
                {
                    path: "/addEquipment",
                    name: "添加设备",
                    hidden: true,
                    component: resolve =>
                        require([
                            "@/views/equipment/addEquipment/addEquipment"
                        ], resolve),
                    meta: {
                        title: "添加设备",
                        GuidePath: true,
                        JumpPath: "/equipment"
                    }
                },
                {
                    path: "/editEquipment",
                    name: "修改设备",
                    hidden: true,
                    component: resolve =>
                        require([
                            "@/views/equipment/editEquipment/editEquipment"
                        ], resolve),
                    meta: {
                        title: "修改设备",
                        GuidePath: true,
                        JumpPath: "/equipment"
                    }
                },
                {
                    path: "/equipmentDetail",
                    name: "设备详情",
                    hidden: true,
                    component: resolve =>
                        require([
                            "@/views/equipment/equipmentDetail/equipmentDetail"
                        ], resolve),
                    meta: {
                        title: "设备详情",
                        GuidePath: true,
                        JumpPath: "/equipment"
                    }
                },
                {
                    path: "/cooperation",
                    name: "合作车辆",
                    component: resolve => require(["@/App"], resolve),
                    children: [
                        {
                            path: "/companyVehicles",
                            name: "企业合作车辆",
                            component: resolve =>
                                require([
                                    "@/views/cooperationVehicle/companyVehicles"
                                ], resolve)
                        },
                        {
                            path: '/platformVehicles',
                            name: "平台合作车辆",
                            component: resolve =>
                                require([
                                    "@/views/cooperationVehicle/platformVehicles"
                                ], resolve)
                        },
                        {
                            path: '/cooperationActive',
                            name: "合作车辆活动",
                            component: resolve =>
                                require([
                                    "@/views/cooperationVehicle/cooperationActive"
                                ], resolve)
                        }
                    ]
                },
                {
                    path: "/authoritySetting",
                    name: "权限",
                    component: resolve => require(["@/App"], resolve),
                    children: [
                        {
                            path: "/authority",
                            name: "权限管理",
                            component: resolve =>
                                require([
                                    "@/views/authority/authority"
                                ], resolve),
                        },
                        {
                            path: "/staffManagement",
                            name: "人员管理",
                            component: resolve =>
                                require([
                                    "@/views/authority/staffManagement"
                                ], resolve)
                        },
                        {
                            path: "/storeBinding",
                            name: "加盟商管理",
                            component: resolve =>
                                require([
                                    "@/views/authority/storeBinding/storeBinding"
                                ], resolve)
                        },
                        {
                            path: "/clerkManagement",
                            name: "加盟商员工管理",
                            component: resolve =>
                                require([
                                    "@/views/authority/clerkManagement/clerkManagement"
                                ], resolve)
                        },
                    ]
                },
                {
                    path: "/campaign",
                    name: "广告活动管理",
                    component: resolve =>
                        require(["@/views/campaign/campaign"], resolve)
                },
                {
                    path: "/addCampaign",
                    name: "添加广告活动",
                    component: resolve =>
                        require(["@/views/campaign/addCampaign"], resolve),
                    meta: {
                        title: "添加广告活动",
                        GuidePath: true,
                        JumpPath: "/campaign"
                    }
                },
                {
                    path: "/editCampaign",
                    name: "编辑广告活动",
                    component: resolve =>
                        require(["@/views/campaign/editCampaign"], resolve),
                    meta: {
                        title: "编辑广告活动",
                        GuidePath: true,
                        JumpPath: "/campaign"
                    }
                },
                {
                    path: "/member",
                    name: "会员日",
                    component: resolve =>require(["@/views/member/member"], resolve),
                },
                {
                    path: "/membercoupon",
                    name: "会员日优惠券",
                    component: resolve =>require(["@/views/member/membercoupon"], resolve),
                },
                {
                    path: "/goods",
                    name: "积分商城",
                    // redirect: "/goodsmanage",
                    component: resolve => require(["@/App"], resolve),
                    children: [
                        {
                            path: "/goodsclassify",
                            name: "商品分类",
                            component: resolve =>
                                require([
                                    "@/views/goods/goodsclassify"
                                ], resolve)
                        },
                        {
                            path: "/goodsmanage",
                            name: "商品管理",
                            component: resolve =>
                                require([
                                    "@/views/goods/goodsmanage"
                                ], resolve),
                        },
                        {
                            path: "/goodsorder",
                            name: "商品订单",
                            component: resolve =>
                                require([
                                    "@/views/goods/goodsorder"
                                ], resolve),
                        },
                        {
                            path: "/goodsdetails",
                            name: "商品详情",
                            component: resolve =>
                                require([
                                    "@/views/goods/goodsdetails"
                                ], resolve)
                        },
                    ]
                },
                {
                    path: "/redeemCode",
                    name: "券码兑换",
                    component: resolve =>
                        require([
                            "@/views/redeemCode/redeemCode"
                        ], resolve)
                },
                {
                    path: "/authorityPhone",
                    name: "授权电话",
                    component: resolve =>
                        require([
                            "@/views/authorityPhone/authorityPhone"
                        ], resolve)
                },
                {
                    path: "/city",
                    name: "城市管理",
                    component: resolve =>
                        require([
                            "@/views/city/city"
                        ], resolve)
                },
                {
                    path: "/spread",
                    name: "推广人员",
                    component: resolve => require(["@/views/spread/spread"], resolve),
                },
                {
                    path: "/spreaddetails",
                    name: "推广详情",
                    component: resolve => require(["@/views/spread/spreaddetails/spreaddetails"],resolve),
                    meta: {
                        title: "推广用户",
                        GuidePath: true,
                        JumpPath: "/spread"
                    }
                },
                {
                    path: "/spreadUser",
                    name: "推广用户",
                    component: resolve => require(["@/views/spread/spreadUser/spreadUser"],resolve),
                    meta: {
                        title: "推广用户",
                        GuidePath: true,
                        JumpPath: "/spread"
                    }
                },
                {
                    path: "/videoManagment",
                    name: "视频管理",
                    component: resolve =>
                        require([
                            "@/views/videoManagment/videoManagment"
                        ], resolve)
                },
                {
                    path: "/setting",
                    name: "设置",
                    component: resolve => require(["@/App"], resolve),
                    children: [
                        {
                            path: "/personalData",
                            name: "个人资料",
                            component: resolve =>
                                require([
                                    "@/views/personalData/personalData"
                                ], resolve)
                        },
                        {
                            //密码修改路径
                            path: "/changePassword",
                            name: "密码修改",
                            component: resolve =>
                                require([
                                    "@/views/changePassword/changePassword"
                                ], resolve)
                        }
                    ]
                },
                {
                    path: "/shop",
                    name: "门店",
                    component: resolve => require(["@/views/shop/shop"], resolve),
                    meta: {
                        title: "门店",
                        GuidePath: true,
                        JumpPath: "/storeBinding"
                    }
                },
                {
                    path: "/integralRule",
                    name: "积分规则",
                    component: resolve => require(["@/views/integral/integralRule"], resolve)
                },
                {
                    path: "/integralDetails",
                    name: "积分明细",
                    component: resolve => require(["@/views/integral/integralDetails"], resolve),
                    meta: {
                        title: "用户中心",
                        GuidePath: true,
                        JumpPath: "/userCenter"
                    }
                }
            ]
        }
    ]
});




// 解决ElementUI导航栏中的vue-router在3.0版本以上重复点菜单报错问题
const originalPush = Router.prototype.push
Router.prototype.push = function push(location) {
    return originalPush.call(this, location).catch(err => err)
}

export default routers
